Hi Expert!
How to get previous selection of dropdown value when I click button. I refer below coding
$(".addToButton").live('click', function (e) {
var sel = $(this).prevAll(".addToList:first"),
val = sel.val(),
text = sel.find(':selected').text();
});
But it is not working. How should I get previous selection of dropdown value when I click button?
Thank in advance!
AVADHESH PATEL
08-Apr-2013(function () {var prevVal;
$("select").focus(function () {
// For storing current value on focus and on change
prevVal = this.value;
}).change(function() {
// Get new value in previous varible storage
prevVal= this.value;
});
$("btnGet").click(function(){
alert("This is previous value: "+prevVal);
});
})();